package com.glorysoft.wangnianxinpda.activity;

import android.content.Context;
import android.os.Bundle;

import com.glorysoft.wangnianxinpda.R;
import com.glorysoft.wangnianxinpda.base.BaseActivity;
import com.glorysoft.wangnianxinpda.callback.StringCommonCallBack;
import com.glorysoft.wangnianxinpda.dialog.InputFragmentDialog;
import com.pda.platform.ui.ui_pdaplatform.callback.FreeUI_CommonCallback;
import com.pda.platform.ui.ui_pdaplatform.entity.FreeUI_AddViewEntity;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_ActivityManager;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_Utils;

/**
 * @Author Zhangjy
 * @Date 2021/6/28 16:49
 * Description :
 */
public class DialogActivity extends BaseActivity {
    private InputFragmentDialog InputFragmentDialog = null;
    private Context mContext;
    @Override
    protected int getLayoutResId() {
        return 0;
    }

    @Override
    protected void initView() {
        mContext = this;
//        val extra = intent.getStringExtra(FreeApi_StaticMembers.SHOW_PLUGIN_KEY)
        String extra = getIntent().getStringExtra("showPlugin");

        InputFragmentDialog = new InputFragmentDialog();
        String lint = getString(R.string.scanDeviceBarCode);
        if (extra.equals("SupplementaryDataActivity") || extra.equals("QcActivity")) {
            lint = "请扫描LOT条码";
        } else if (extra.equals("MoldReplaceActivity")) {
            lint = "请扫描模具";
        } else if (extra.equals("DailyInspectionActivity")) {
            lint = " 请扫描设备或LOT条码";
        }
        InputFragmentDialog.setCallBackAndWhere(lint, new StringCommonCallBack() {
            @Override
            public void onCallback(String str) {
                Bundle bundle = new Bundle();
                bundle.putString("EQPID", str);
                switch (extra){
                    case "BatchWorkBeginActivity": FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, BatchWorkBeginActivity.class); break;
                    case "BatchWorkEndActivity": FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, BatchWorkEndActivity.class); break;
                    case "MaterialExchangeActivity": FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, MaterialExchangeActivity.class); break;
                    case "EngineerModelActivity": FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, EngineerModelActivity.class); break;
                    case "RecipeDownLoadActivity": FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, RecipeDownLoadActivity.class); break;
                    case "RecipeUpLoadActivity": FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, RecipeUpLoadActivity.class); break;
                    case "ChangeShiftActivity": FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, ChangeShiftActivity.class); break;

                }
            }

            @Override
            public void onCallback(int str) {

            }
        }, "");

        InputFragmentDialog.setCallBack(new FreeUI_CommonCallback() {
            @Override
            public void onSuccess() {
                finish();
                FreeApi_ActivityManager.getActivityManager().finishActivity();
            }
        });
        InputFragmentDialog.show(getSupportFragmentManager(), "EQP_DIALOG");
    }

    @Override
    protected void initData() {

    }

    @Override
    protected FreeUI_AddViewEntity getBaseEntity() {
        return null;
    }
}
